<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      
    }
  },
  methods: {
    roderTime() {
      const timeArr = JSON.parse(localStorage.getItem('timeArr'))
      const date = new Date()
      const time = date.getTime()
      timeArr.map((item, index) => {
        let timeList = JSON.parse(localStorage.getItem(item))
        if(timeList.time > time) {
          console.log('倒计时---', timeList.time - time)
          setTimeout(() => {
            localStorage.removeItem(item)
            timeList.splice(index, 1)
            localStorage.setItem('timeArr', JSON.stringify(timeList))
            console.log('倒计时取消订单')
          }, timeList.time - time)
        } else {
          localStorage.removeItem(item)
          timeList.splice(index, 1)
          localStorage.setItem('timeArr', JSON.stringify(timeList))
          console.log('取消订单')
        }
      })
    },
  },
  mounted() {
    // this.roderTime()
  }
}
</script>

<style lang="less">
html,
body {
  position: relative;
  height: 100vh;
  max-height: 100vh;
}
#app {
  height: 100%;
  max-height: 100%;
}
</style>
